
/* 
     Purpose: This file uses the following dictionary 
              (alongside the codebook) to bring in raw data.
    
     Creates: ocg1973.dta
*/

clear
cd "$Mydirectory1/1_DataSources/CPS_1962_1973/"

**********************************************************

infix ///
	region 16 ///
	urban 27 ///
	reltohead_ccm 90 ///
	age_ccm 91-92 ///
	marital_ccm 93 /// 
	occ_ccm 85-87 /// 
	classwkr_ccm 81 /// 
	race_ccm 94 ///
	sex_ccm 95 ///
	schl_ccm 97-98 ///
	grade_ccm 99 ///
	employment_ccm 100 /// 
	houserel_ccm 133 ///
	income_total_ccm 235-240 ///
	income_ttlrec_ccm 301-302 ///
	family_fc 339-340 ///
	famtype_fc 341 ///
	familyhead_fc 342 ///
	R_hhsize_plusR 383-384 ///
	income_fam_fc 385-390 ///
	income_hh_fc 451-456 ///
	income_hw_fc 457-461 ///
	reltohead_ccw 552 ///
	age_ccw 553-554 ///
	race_ccw 556 ///
	sex_ccw 557 ///
	schl_ccw 559-560 ///
	income_total_ccw 679-684 ///
	income_ttlrec_ccw 745-746 ///
	R_num_sisters 839-840 ///
	R_num_brothers 843-844 ///
	R_livewbothparents_age16 853 ///
	R_headofhh_age16 854 ///
	income_fam16_ocg 855-856 ///
	dad_occ1960 871-873 /// 
	dad_occ1970 874-876 /// 
	dad_clsswrk 877 /// 
	unionmem 965 /// 
	veteranwar 96 /// 
	schl_dad_ocg 879-880 ///
	schl_mom_ocg 881-882 ///
	schl_resp_ocg 885-886 ///
	schl_wifedad_ocg 997-998 ///
	schl_wifemom_ocg 999-1000 ///
	weight_bsc 1003-1014 ///
	weight_alt 1015-1026 ///
	weight_cps 1027-1038 ///
	bpl 826-828 ///
	fbpl 829-831 ///
	mbpl 832-834 ///
    using "./RawData/06162-0002-Data.txt" //download from ICPSR website. Search ICPSR 6162. Name is the same

**********************************************************
	
/// Characteristics of Civilan Males (CCM) ///
label variable reltohead_ccm "Relationship to head of household, CCM"
label variable age_ccm  "Age, CCM"
label variable occ_ccm "Occupation, CCM"
label variable classwkr_ccm "Class of worker, CCM"
label variable race_ccm "Race, CCM"
label variable sex_ccm "Sex, CCM"
label variable schl_ccm "Highest grade (of school) attended, CCM"
label variable grade_ccm "Grade Completed, CCM"
label variable houserel_ccm "Household relationship, CCM"
label variable income_total_ccm "Total Income (each dollar), CCM"
label variable income_ttlrec_ccm "Total Income - Recode, CCM"
label variable employment_ccm "Employment status, CCM"

/// Family Characteristics (FC) ///
label variable region "Region, FC"
label variable urban "Urban, FC"
label variable family_fc "Family type, FC"
label variable famtype_fc  "Type of family or subfamily, FC"
label variable familyhead_fc "Sex and marital status of family (or subfamily) head and labor force status of wife, FC"
label variable income_fam_fc "Total Family Income (each dollar), CCM"
label variable income_hh_fc "Total Household Income (each dollar), CCM"
label variable income_hw_fc "Total Income of Husband and Wife (each dollar), CCM"

/// Characteristics of the Wife (CCW) ///
label variable reltohead_ccw "Relationship to head of household, CCW"
label variable age_ccw "Age, CCW"
label variable race_ccw "Race, CCW"
label variable sex_ccw "Sex, CCW"
label variable schl_ccw "Highest grade (of school) attended, CCW"
label variable income_total_ccw "Total Income (each dollar), CCW"
label variable income_ttlrec_ccw "Total Income - Recode, CCW"

/// Occupational Changes in a Generation (OCG) ///
label variable income_fam16_ocg "Family's annual income at age 16, OCG"
label variable schl_dad_ocg "Highest grade completed by father, OCG"
label variable schl_mom_ocg "Highest grade completed by mother, OCG"
label variable schl_resp_ocg "Highest grade completed by respondent, OCG"
label variable schl_wifedad_ocg "Highest grade completed by wife's father, OCG"
label variable schl_wifemom_ocg "Highest grade completed by wife's mother, OCG"

///Other Variables EMJ added 
label variable dad_occ1960 "Father's occupation, 1960 code"
label variable dad_occ1970 "Father's occupation, 1970 code"
label variable dad_clsswrk "Father class of worker"
label variable unionmem "Labor union member"
label variable veteranwar "Veteran status"

/// Weights ///
label variable weight_bsc "Basic Weight"
label variable weight_alt "Alternate Weight"
label variable weight_cps "CPS March Weight"

**********************************************************

label data "OCG 1973"

#delimit ;
label define region      1.00 "Northeast" 2.00 "North Central"
                       3.00 "South" 4.00 "West";
label define urban      1.00 "Urban" 2.00 "Rural"
                       4.00 "?";					   
label define race      1.00 "White" 2.00 "Black"
                       3.00 "Other";
label define sex       1.00 "Male" 2.00 "Female";
label define school1   1.00 "None" 2.00 "Elementary 1"
                       3.00 "Elementary 2" 4.00 "Elementary 3"
                       5.00 "Elementary 4" 6.00 "Elementary 5"
                       7.00 "Elementary 6" 8.00 "Elementary 7"
                       9.00 "Elementary 8" 10.00 "High School 1"
                       11.00 "High School 2"
                       12.00 "High School 3"
                       13.00 "High School 4"
                       14.00 "College 1" 15.00 "College 2"
                       16.00 "College 3" 17.00 "College 4"
                       18.00 "College 5" 19.00 "College 6+";
label define income1   0.00 "No income (or loss)" 1.00 "$1-499"
                       2.00 "$500-999" 3.00 "$1,000-1,999"
                       4.00 "$2,000-2,999" 5.00 "$3,000-3,999"
                       6.00 "$4,000-4,999" 7.00 "$5,000-5,999"
                       8.00 "$6,000-6,999" 9.00 "$7,000-7,999"
                       10.00 "$8,000-8,999"
                       11.00 "$9,000-9,999"
                       12.00 "$10,000-14,999"
                       13.00 "$15,000 or more";
label define income2   1.00 "None"
                       2.00 "Loss" 
					   3.00 "$1-499"
                       4.00 "$500-999" 
					   5.00 "$1,000-1,499"
                       6.00 "$1,500-1,999" 
					   7.00 "$2,000-2,499"
                       8.00 "$2,500-2,999" 
					   9.00 "$3,000-3,499"
                       10.00 "$3,500-3,999"
                       11.00 "$4,000-4,499"
                       12.00 "$4,500-4,999"
                       13.00 "$5,000-5,999"
					   14.00 "$6,000-6,999"
					   15.00 "$7,000-7,999"
                       16.00 "$8,000-8,999"
					   17.00 "$9,000-9,999"
                       18.00 "$10,000-10,999" 
					   19.00 "$11,000-11,999"
                       20.00 "$12,000-12,999" 
					   21.00 "$13,000-13,999"
                       22.00 "$14,000-14,999"
                       23.00 "$15,000-19,999"
                       24.00 "$20,000-24,999"
                       25.00 "$25,000-29,999"
					   26.00 "$30,000-34,999"
                       27.00 "$35,000-39,999"
                       28.00 "$40,000-44,999"
                       29.00 "$45,000-49,999" 
					   30.00 "$50,000 and over";
label define school2   0.00 "Never attended" 1.00 "Elementary 1"
                       2.00 "Elementary 2" 3.00 "Elementary 3"
                       4.00 "Elementary 4" 5.00 "Elementary 5"
                       6.00 "Elementary 6" 7.00 "Elementary 7"
                       8.00 "Elementary 8" 9.00 "High School 1"
                       10.00 "High School 2"
                       11.00 "High School 3"
                       12.00 "High School 4"
                       13.00 "College 1" 14.00 "College 2"
                       15.00 "College 3" 16.00 "College 4"
                       17.00 "College 5+";
label define headrel   1.00 "Head with other relatives including wife in HH"
                       2.00 "Head with no other relatives in HH" 
					   3.00 "Wife of head"
                       4.00 "Other relative of head" 
					   5.00 "Nonrelative of head with own relatives in HH"
                       6.00 "Nonrelative of head with no own relatives in HH";
label define hhold     1.00 "Male head, living with relatives "
                       2.00 "Male head, living without relatives " 
					   3.00 "Male relative of head "
                       4.00 "Male nonrelative of head";
label define fam1      1.00 "Primary family/no subfamily"
                       2.00 "Primary family/one or more subfamilies" 
					   3.00 "Secondary family"
                       4.00 "Subfamily" 
					   5.00 "Unrelated: primary individual"
                       6.00 "Unrelated: seconday individual in a HH" 
					   7.00 "Unrelated: seconday individual in a GQ";
label define fam2      1.00 "Husband/Wife family"
                       2.00 "Other Male Head family" 
					   3.00 "Female Head";
label define fam3      1.00 "Male head, married, wife present, wife in paid labor force"
                       2.00 "Male head, married, wife present, wife not in paid labor force" 
					   3.00 "Male head, other marital status"
                       4.00 "Female head"; 	
label define yesno     1.00 "Yes"
                       2.00 "No";
label define clss	   1 "Private business" 2 "Govt employee" 3 "Self-employed, not inc."
					   4 "Self-employed, inc.s" 5 "Without pay";
label define union 	   1 "Yes" 2 "No";	
label define vetstat   1 "Vietnam" 2 "Korea" 3 "WWII" 4 "WWI" 5 "Other" 6 "non-veteran";
label define emp 	   1 "Employed, working" 2 "Employed, with job not at work" 3 "Unmployed" 4 "House" 5 "School" 6 "Unable" 7 "Other";
					   
#delimit cr

label values region region
label values urban urban
label values race_ccm race
label values race_ccw race
label values sex_ccm sex
label values sex_ccw sex
label values schl_ccm school1
label values schl_ccw school1
label values schl_dad_ocg school2
label values schl_mom_ocg school2
label values schl_resp_ocg school2
label values schl_wifedad_ocg school2
label values schl_wifemom_ocg school2
label values income_fam16_ocg income1
label values income_ttlrec_ccm income2
label values income_ttlrec_ccw income2
label values reltohead_ccm headrel
label values reltohead_ccw headrel
label values houserel_ccm hhold
label values family_fc fam1
label values famtype_fc fam2
label values familyhead_fc fam3
label values grade_ccm
label values dad_clsswrk clss
label values unionmem union
label values veteranwar vetstat
label values employment_ccm emp

********************************************************************

* Add ID variable
gen id = _n
label variable id "ID number"

* Recode negative total incomes
replace income_total_ccm = -1*income_total_ccm if income_ttlrec_ccm==2

********************************************************************

save "./output/ocg1973.dta", replace
